package com.deli.springboot.service;

import com.deli.springboot.entity.Comment;
import com.deli.springboot.mapper.CommentMapper;
import com.deli.springboot.repository.CommentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("commentService")
public class CommentServiceImpl implements CommentService {
   /* @Autowired
    private CommentRepository commentRepository;*/
   @Autowired
   private CommentMapper commentMapper;

    @Override
    public List<Comment> findByBid(Long bookId) {
        //List<Comment> comments = commentRepository.selectByExample(bookId);
        List<Comment> comments = commentMapper.selectByExample(bookId);
        return comments;

    }

    @Override
    public Integer add(Comment comment) {
        //Integer result = commentRepository.add(comment);
        Integer result = commentMapper.add(comment);
        return result;
    }
}
